//创建用户相关的小仓库
import { defineStore } from "pinia";
//引入请求函数
import { reqAlarms } from "@/api/alarms/alarms";
// 引入组件库
import { ElMessage } from "element-plus";

/**
 * 
 * @methods  
 */
export const useAlarmsStore = defineStore("alarmsStore", {
  state: () => ({
    alarmsLength:'',//告警长度
    TotalRecords: "", //常规告警中心中的总页数
    DataSource: [], ////常规告警中心中的表格数据
  }),
  //书写小仓库方法的地方
  actions: {
    async alarms(data: any) {
      try {
        let res: any = await reqAlarms(data);
        this.TotalRecords = res.TotalRecords
        this.DataSource = res.DataSource
        this.alarmsLength = res.length
        
      } catch (error) {
        console.log(error);
      }
    }
  },
});
